import { Resend } from "resend";

const resend = new Resend(process.env.RESEND_API_KEY);
export const sendVerificationEmail = async (email: string, token: string) => {
  const data = await resend.emails.send({
    from: "Acme <onboarding@resend.dev>",
    to: email,
    subject: "OAuth Login",
    html: `<a href="http://localhost:3000/auth/new-verification?token=${token}">Click here to verify your email</a>`,
  });
};

export const sendResetPasswordEmail = async (email: string, token: string) => {
  const data = await resend.emails.send({
    from: "Acme <onboarding@resend.dev>",
    to: email,
    subject: "Forgot Password",
    html: `<a href="http://localhost:3000/auth/new-password?token=${token}">Click here to verify your email</a>`,
  });
};

export const sendTwoFactoryEmail = async (email: string, token: string) => {
  const data = await resend.emails.send({
    from: "Acme <onboarding@resend.dev>",
    to: email,
    subject: "2FA Code",
    html: `<p>Your 2FA Code:${token} <p/>`,
  });
};
